<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //延时函数版本3
        function delay(duration,n){
            return new Promise((reject)=>{
                setTimeout(()=>{
                    console.log(n)  //打印数据
                    reject('Ok')
                },duration)
            })
        }
        async function log(){
            const n1=await delay(2000,1)
            console.log(n1)
            const n2=await delay(1000,2)
            console.log(n2)
            const n3=await delay(1000,3)
            console.log(n3)
        }
        log()
    </script>
</body>
</html>